package com.itheima.pojo;

import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Data
@Component
public class Category {
    @NotNull(groups = Update.class) /* 分组划分 */
    private Integer id;//主键ID

    @NotEmpty(groups = {Add.class, Update.class})
    @Pattern(regexp = "^\\S{1,10}$", groups = {Add.class, Update.class})
    private String categoryName;//分类名称

    @NotEmpty(groups = {Add.class, Update.class})
    @Pattern(regexp = "^\\S{1,10}$", groups = {Add.class, Update.class})
    private String categoryAlias;//分类别名

    private Integer createUser;//创建人ID
    private LocalDateTime createTime;//创建时间
    private LocalDateTime updateTime;//更新时间

    //    定义分组
    public interface Add {}

    public interface Update {}
}
